require 'shared_file'
require 'yaml'
class ConfigReader
  
  attr_reader :port, :shared_files, :server
  def initialize(config_file)
    yaml_file = get_content(config_file)
    @port = yaml_file["agent port"]
    @server = yaml_file["server url"]
    @shared_files = []
    yaml_file["shared files"].each do |file|
      share = SharedFile.new(file["path"], file["tags"])
      @shared_files << share
    end
  end

  def get_content(config_file)
    content = nil
    File.open( config_file ) { |yf| content = YAML::load( yf ) }
    content
  end

end
